string[] filePaths = Directory.GetFiles("D:\\Users\\Images\\Pictures\\");
List<ListItem> files = new List<ListItem>();
foreach (string filePath in filePaths)
{
string fileName = Path.GetFileName(filePath);
files.Add(new ListItem(fileName, @"D:\Users\Images\Pictures\" + fileName)); //i can get image name --D:\Users\Images\Pictures\flight.jpg
}
Repeater1.DataSource = files;
Repeater1.DataBind();
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<li>
<img src='<%# DataBinder.Eval(Container.DataItem,"Value") %>' title='<%# (DataBinder.Eval(Container.DataItem,"Text").ToString()).Split('.')[0].ToString() %>' alt=""></li>
</ItemTemplate>
</asp:Repeater>
To bind images in repeater using asp.net
2194
01-Jun-2015
in this sample i want to bind the image from local drive to repeater but not bind properly.
Anonymous User
01-Jun-2015Create a GenericHandler.
Note: When your application moves to production, You need to make sure D:\Users\Images folder exists in web server.